<%@page import="model.CategoryImp"%>
<%@page import="model.ProductImp"%>
<%@page import="model.entity.*"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.io.*,java.util.*, javax.servlet.*" %>


<div class="tab_container">
    <div id="tab2" class="tab_content" style="display: block;">
        <h2>Edit Product</h2>

        <p>
            Enter information to edit product.
        </p>
        <p class="message1">
<%
                            String message1 = request.getAttribute("messageedit")==null ? "":request.getAttribute("messageedit").toString();
                        out.println(message1);
%>
                 </p>
        <%
            Product prod = (Product) request.getAttribute("editproduct");
            CategoryImp cim = new CategoryImp();
        %>  
        <form action="<c:url value="<%= "/admin/product/edit/" + prod.getProductid()%>" />" method="POST" name="frmedit" enctype="multipart/form-data" >


            <p>
               
                <input type="text" hidden="true" class="text normal" name="productid" value="<%= prod.getProductid()%>"> 
            
                <label>Category:</label><input hidden="true" type="text" readonly="true" class="text small" name="categoryid" value="<%= prod.getCategoryid()%>"> <%= cim.DetailCategory(prod.getCategoryid()).getCategoryname() %>
            </p>
            <p>
                <label>Product Name:</label><br/><input type="text" class="text medium" name="productname" value="<%= prod.getProductname()%>"> 
            </p>
            <p>
                <label>Quantity:</label>
                <input type="text" class="text normal" name="quantity" value="<%= prod.getQuantity() %>">
            </p>
            <p>
                <input type="text" hidden="true" name="productid" value="<%= prod.getProductid() %>" />
            </p>
            <p>
                <input type="text" hidden="true" name="picture" value="<%= prod.getPicture() %>" />
            </p>
            <p>
                <label>UnitCost:</label><input type="text" class="text normal" name="unitcost" value="<%= prod.getUnitcost()%>"> USD
            </p>
            <p>
                <label>Product Type:</label>
             	
                  <input  type="radio" checked="checked" name="prodtype" id="RADIO1" value="Normal">
                  <label for="RADIO1">Normal</label>
                  <input type="radio" name="prodtype" id="RADIO2" value="Special">
                  <label for="RADIO2">Special</label>
                  <input type="radio" name="prodtype" id="RADIO3" value="Discount">
                  <label for="RADIO3">Discount</label>
      
            </p>
            <p>
                <label>Image:</label>
            <ul class="imglist">
                <li>
                    <img src="<c:url value="<%= "/images/product/" + prod.getPicture() + "" %>"></c:url>" width="120px" height="120px" alt="">
                </li>
                
            </ul>
            
            <input type="file" title="Choose"  name="picture" size="50" />
            </p>
            
           
            <p>
                  <label>Detail:</label><br>
                  <textarea name="productdetail"  cols="8" rows="5" ><%= prod.getProductdetail() %></textarea>
            </p>
            
            <p>
                <input type="submit" class="submit" value="Edit" >
            </p>

        </form>

    </div>
</div>